#include "StdAfx.h"
#include "EnemyManager.h"
#include "BasicEnemy.h"
#include "BossEnemy.h"
#include "PatrolEnemy.h"


CEnemyManager::CEnemyManager()
{

	

};
CEnemyManager::~CEnemyManager(){};

void CEnemyManager::AddEnemy(EEnemyType l_type)
{

	CEnemy *l_Enemy = NULL;
	switch(l_type)
	{
		case BASIC:
			l_Enemy = new CBasicEnemy();
			break;
		case PATROL:
			l_Enemy = new CPatrolEnemy();
			break;
		case BOSS:
			l_Enemy = new CBossEnemy();
			break;
		default:
			break;
	}

	if(l_Enemy!=NULL)
	{
		m_Enemies.push_back(l_Enemy);
	}
}

void CEnemyManager::Update()
{
	printf("Updating CEnemyManager...\n");
	tEnemyVector::const_iterator it;
	tEnemyVector::const_iterator itEnd(m_Enemies.end());

	// Acceder a la informacion del vector
	for (it = m_Enemies.begin(); it != itEnd; ++it)
	{
	(*it)->Update();
	}
}
void CEnemyManager::Render()
{
	printf("Rendering CEnemyManager...\n");
	//	tEnemyVector::const_iterator it;
	//tEnemyVector::const_iterator itEnd(m_Enemies.end());

	//// Acceder a la informacion del vector
	//for (it = m_Enemies.begin(); it != itEnd; ++it)
	//{
	//(*it)->Render();
	//}
	for(int i = 0; i < m_Enemies.size(); ++i)
	{
		m_Enemies[i]->Render();
	}


}
